# 多阶段构建Dockerfile
FROM maven:3.9-openjdk-17 AS builder
WORKDIR /app
COPY backend/pom.xml .
COPY backend/ ./
RUN mvn clean package -DskipTests

FROM openjdk:17-jre-slim
WORKDIR /app
COPY --from=builder /app/kexilo-admin/target/kexilo-admin.jar app.jar

# 添加JVM调优参数
ENV JAVA_OPTS="-Xms512m -Xmx2g -XX:+UseG1GC -XX:+UseContainerSupport"

EXPOSE 8080
ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -jar app.jar"]
